<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head>
<title></title>
  <style type="text/css">
    <!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
  </style>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head><body bgcolor="#ffffff">


<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = -->
<!-- =   Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard  markus@jave.de   = -->
<!-- =     Further information: http://www.java2html.de     = -->
<div align="left" class="java">
<table border="0" cellpadding="3" cellspacing="0" bgcolor="#ffffff">
   <tr>
  <!-- start source code -->
   <td nowrap="nowrap" valign="top" align="left">
    <code>
<font color="#7f0055"><b>package&nbsp;</b></font><font color="#000000">aplicacion.utilidades;</font><br />
<font color="#ffffff"></font><br />
<font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;Representa&nbsp;una&nbsp;hora&nbsp;del&nbsp;cuadrante&nbsp;mediante&nbsp;dos&nbsp;valores:</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f7f9f">&lt;p&gt;</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f7f9f">&lt;ul&gt;</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f7f9f">&lt;li&gt;</font><font color="#3f5fbf">hora:&nbsp;La&nbsp;hora,&nbsp;que&nbsp;admite&nbsp;valores&nbsp;mayores&nbsp;que&nbsp;24,&nbsp;que&nbsp;representan&nbsp;la&nbsp;madrugada&nbsp;del&nbsp;d?a&nbsp;siguiente&nbsp;(i.e.&nbsp;26&nbsp;=&nbsp;2&nbsp;a.m.)</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f7f9f">&lt;li&gt;</font><font color="#3f5fbf">cmin:&nbsp;Intervalo&nbsp;de&nbsp;5&nbsp;minutos,&nbsp;es&nbsp;el&nbsp;intervalo&nbsp;m?s&nbsp;peque?o&nbsp;representable.&nbsp;Una&nbsp;hora&nbsp;tiene&nbsp;12&nbsp;cmins,&nbsp;[0-11].</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f7f9f">&lt;/ul&gt;</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@author&nbsp;</font><font color="#3f5fbf">Daniel&nbsp;Dionne</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#7f0055"><b>public&nbsp;class&nbsp;</b></font><font color="#000000">Posicion&nbsp;</font><font color="#000000">{</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>private&nbsp;</b></font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">hora,&nbsp;cmin;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;El&nbsp;constructor&nbsp;de&nbsp;la&nbsp;clase.&nbsp;Si&nbsp;cmin&nbsp;es&nbsp;mayor&nbsp;que&nbsp;11,&nbsp;se&nbsp;deja&nbsp;en&nbsp;11.</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">hora&nbsp;&nbsp;La&nbsp;hora&nbsp;de&nbsp;la&nbsp;posici?n</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">cmin&nbsp;&nbsp;Los&nbsp;cminutos&nbsp;(intervalos&nbsp;de&nbsp;5&nbsp;minutos)</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#000000">Posicion&nbsp;</font><font color="#000000">(</font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">hora,&nbsp;</font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">cmin</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora&nbsp;=&nbsp;hora;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.cmin&nbsp;=&nbsp;cmin;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>if&nbsp;</b></font><font color="#000000">(</font><font color="#7f0055"><b>this</b></font><font color="#000000">.cmin&nbsp;&gt;&nbsp;</font><font color="#990000">11</font><font color="#000000">)&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.cmin&nbsp;=&nbsp;</font><font color="#990000">11</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Devuelve&nbsp;la&nbsp;hora.</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@return&nbsp;</font><font color="#3f5fbf">Un&nbsp;valor&nbsp;positivo</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#dameCMin()</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#ponHora(int)</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#ponCMin(int)</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">dameHora</font><font color="#000000">()&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;</b></font><font color="#000000">hora;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Devuelve&nbsp;el&nbsp;n?mero&nbsp;de&nbsp;intervalos&nbsp;de&nbsp;5&nbsp;minutos.</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Por&nbsp;ejemplo,&nbsp;las&nbsp;12:15&nbsp;devuelve&nbsp;3.</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@return&nbsp;</font><font color="#3f5fbf">Un&nbsp;valor&nbsp;de&nbsp;0&nbsp;a&nbsp;11</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#dameHora()</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#ponHora(int)</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#ponCMin(int)</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">dameCMin</font><font color="#000000">()&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;</b></font><font color="#000000">cmin;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Asigna&nbsp;la&nbsp;hora&nbsp;que&nbsp;se&nbsp;pasa&nbsp;por&nbsp;par?metro.</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">h&nbsp;Un&nbsp;entero&nbsp;que&nbsp;representa&nbsp;la&nbsp;hora.&nbsp;Pasadas&nbsp;las&nbsp;24&nbsp;se&nbsp;consideran&nbsp;horas&nbsp;del&nbsp;d?a&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;siguiente.&nbsp;No&nbsp;se&nbsp;admiten&nbsp;horas&nbsp;negativas.</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@return&nbsp;</font><font color="#3f5fbf">Devuelve&nbsp;</font><font color="#7f7f9f">&lt;i&gt;</font><font color="#3f5fbf">false</font><font color="#7f7f9f">&lt;/i&gt;&nbsp;</font><font color="#3f5fbf">si&nbsp;el&nbsp;par?metro&nbsp;es&nbsp;negativo,&nbsp;</font><font color="#7f7f9f">&lt;i&gt;</font><font color="#3f5fbf">true</font><font color="#7f7f9f">&lt;/i&gt;&nbsp;</font><font color="#3f5fbf">en&nbsp;cualquier&nbsp;otro&nbsp;caso.</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#dameHora()</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#dameCMin()</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#ponCMin(int)</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#7f0055"><b>boolean&nbsp;</b></font><font color="#000000">ponHora</font><font color="#000000">(</font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">h</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>boolean&nbsp;</b></font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>if&nbsp;</b></font><font color="#000000">(</font><font color="#000000">h&lt;</font><font color="#990000">0</font><font color="#000000">)&nbsp;</font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>false</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>else&nbsp;</b></font><font color="#000000">hora&nbsp;=&nbsp;h;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;</b></font><font color="#000000">b;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Asigna&nbsp;los&nbsp;intervalos&nbsp;de&nbsp;5&nbsp;minutos&nbsp;que&nbsp;se&nbsp;pasan&nbsp;por&nbsp;par?metro.</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">m&nbsp;Un&nbsp;entero&nbsp;que&nbsp;representa&nbsp;el&nbsp;n?mero&nbsp;de&nbsp;intervalos&nbsp;de&nbsp;5&nbsp;minutos.&nbsp;Debe&nbsp;estar&nbsp;en&nbsp;el&nbsp;rango&nbsp;[0,11].</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@return&nbsp;</font><font color="#3f5fbf">Devuelve&nbsp;</font><font color="#7f7f9f">&lt;i&gt;</font><font color="#3f5fbf">false</font><font color="#7f7f9f">&lt;/i&gt;&nbsp;</font><font color="#3f5fbf">si&nbsp;el&nbsp;par?metro&nbsp;se&nbsp;sale&nbsp;del&nbsp;rango&nbsp;[0,11].&nbsp;</font><font color="#7f7f9f">&lt;i&gt;</font><font color="#3f5fbf">True</font><font color="#7f7f9f">&lt;/i&gt;&nbsp;</font><font color="#3f5fbf">en&nbsp;cualquier&nbsp;otro&nbsp;caso.</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#dameHora()</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#dameCMin()</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@see&nbsp;</font><font color="#3f5fbf">#ponHora(int)</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#7f0055"><b>boolean&nbsp;</b></font><font color="#000000">ponCMin</font><font color="#000000">(</font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">m</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>boolean&nbsp;</b></font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>if&nbsp;</b></font><font color="#000000">(</font><font color="#000000">m&lt;</font><font color="#990000">0&nbsp;</font><font color="#000000">||&nbsp;m&gt;</font><font color="#990000">11</font><font color="#000000">)&nbsp;</font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>false</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>else&nbsp;</b></font><font color="#000000">cmin&nbsp;=&nbsp;m;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;</b></font><font color="#000000">b;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Asigna&nbsp;a&nbsp;esta&nbsp;instancia&nbsp;la&nbsp;suma&nbsp;de&nbsp;una&nbsp;posici?n&nbsp;menos&nbsp;un&nbsp;ancho,&nbsp;definidos&nbsp;por&nbsp;dos&nbsp;posiciones</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">p&nbsp;&nbsp;&nbsp;&nbsp;La&nbsp;posici?n&nbsp;inicial</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">ancho&nbsp;&nbsp;La&nbsp;cantidad&nbsp;de&nbsp;tiempo&nbsp;a&nbsp;sumar&nbsp;a&nbsp;esa&nbsp;posici?n</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#7f0055"><b>void&nbsp;</b></font><font color="#000000">suma&nbsp;</font><font color="#000000">(</font><font color="#000000">Posicion&nbsp;p,&nbsp;Posicion&nbsp;ancho</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">x&nbsp;=&nbsp;p.hora*</font><font color="#990000">12&nbsp;</font><font color="#000000">+&nbsp;ancho.hora*</font><font color="#990000">12&nbsp;</font><font color="#000000">+&nbsp;p.cmin&nbsp;+&nbsp;ancho.cmin;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora&nbsp;=&nbsp;x/</font><font color="#990000">12</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.cmin&nbsp;=&nbsp;x%</font><font color="#990000">12</font><font color="#000000">;</font><br />
<font color="#ffffff"></font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Asigna&nbsp;a&nbsp;esta&nbsp;instancia&nbsp;la&nbsp;resta&nbsp;de&nbsp;una&nbsp;posici?n&nbsp;menos&nbsp;un&nbsp;ancho,&nbsp;definidos&nbsp;por&nbsp;dos&nbsp;posiciones</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">p&nbsp;&nbsp;&nbsp;&nbsp;La&nbsp;posici?n&nbsp;inicial</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">ancho&nbsp;&nbsp;La&nbsp;cantidad&nbsp;de&nbsp;tiempo&nbsp;a&nbsp;restar&nbsp;a&nbsp;esa&nbsp;posici?n</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#7f0055"><b>void&nbsp;</b></font><font color="#000000">resta&nbsp;</font><font color="#000000">(</font><font color="#000000">Posicion&nbsp;p,&nbsp;Posicion&nbsp;ancho</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">x&nbsp;=&nbsp;p.hora*</font><font color="#990000">12&nbsp;</font><font color="#000000">-&nbsp;ancho.hora*</font><font color="#990000">12&nbsp;</font><font color="#000000">+&nbsp;p.cmin&nbsp;-&nbsp;ancho.cmin;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;x/</font><font color="#990000">12</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.cmin&nbsp;=&nbsp;x%</font><font color="#990000">12</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Calcula&nbsp;la&nbsp;diferencia&nbsp;de&nbsp;tiempo&nbsp;(en&nbsp;valor&nbsp;absoluto)&nbsp;entre&nbsp;esta&nbsp;y&nbsp;una&nbsp;posici?n&nbsp;dada.&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">p&nbsp;&nbsp;&nbsp;&nbsp;La&nbsp;posici?n&nbsp;a&nbsp;la&nbsp;que&nbsp;calcular&nbsp;la&nbsp;distancia</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@return&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">La&nbsp;distancia&nbsp;en&nbsp;valor&nbsp;absoluto</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#000000">Posicion&nbsp;diferencia&nbsp;</font><font color="#000000">(</font><font color="#000000">Posicion&nbsp;p</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">x&nbsp;=&nbsp;Math.abs</font><font color="#000000">(</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora*</font><font color="#990000">12&nbsp;</font><font color="#000000">-&nbsp;p.hora*</font><font color="#990000">12&nbsp;</font><font color="#000000">+&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.cmin&nbsp;-&nbsp;p.cmin</font><font color="#000000">)</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;new&nbsp;</b></font><font color="#000000">Posicion</font><font color="#000000">(</font><font color="#000000">x/</font><font color="#990000">12</font><font color="#000000">,&nbsp;x%</font><font color="#990000">12</font><font color="#000000">)</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Compara&nbsp;esta&nbsp;posici?n&nbsp;con&nbsp;la&nbsp;Posici?n&nbsp;p</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">p&nbsp;&nbsp;&nbsp;&nbsp;Posici?n&nbsp;que&nbsp;comparar</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@return&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">this&nbsp;&lt;=&nbsp;p</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#000000">Boolean&nbsp;menorOIgualQue&nbsp;</font><font color="#000000">(</font><font color="#000000">Posicion&nbsp;p</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">Boolean&nbsp;b&nbsp;=&nbsp;</font><font color="#7f0055"><b>false</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>if&nbsp;</b></font><font color="#000000">(</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora&nbsp;&lt;=&nbsp;p.hora</font><font color="#000000">)&nbsp;</font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>else&nbsp;if&nbsp;</b></font><font color="#000000">(</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora&nbsp;==&nbsp;p.hora&nbsp;&amp;&amp;&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.cmin&nbsp;&lt;=&nbsp;p.cmin</font><font color="#000000">)&nbsp;</font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;</b></font><font color="#000000">b;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Compara&nbsp;esta&nbsp;posici?n&nbsp;con&nbsp;la&nbsp;Posici?n&nbsp;p</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">p&nbsp;&nbsp;&nbsp;&nbsp;Posici?n&nbsp;que&nbsp;comparar</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@return&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">this&nbsp;&gt;&nbsp;p</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#000000">Boolean&nbsp;mayorQue&nbsp;</font><font color="#000000">(</font><font color="#000000">Posicion&nbsp;p</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">Boolean&nbsp;b&nbsp;=&nbsp;</font><font color="#7f0055"><b>false</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>if&nbsp;</b></font><font color="#000000">(</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora&nbsp;&gt;&nbsp;p.hora</font><font color="#000000">)&nbsp;</font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>else&nbsp;if&nbsp;</b></font><font color="#000000">(</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora&nbsp;==&nbsp;p.hora&nbsp;&amp;&amp;&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.cmin&nbsp;&gt;&nbsp;p.cmin</font><font color="#000000">)&nbsp;</font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;</b></font><font color="#000000">b;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Compara&nbsp;esta&nbsp;posici?n&nbsp;con&nbsp;la&nbsp;Posici?n&nbsp;p</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@param&nbsp;</font><font color="#3f5fbf">p&nbsp;&nbsp;&nbsp;&nbsp;Posici?n&nbsp;que&nbsp;comparar</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@return&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">this&nbsp;&gt;=&nbsp;p</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#000000">Boolean&nbsp;mayorOIgualQue&nbsp;</font><font color="#000000">(</font><font color="#000000">Posicion&nbsp;p</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">Boolean&nbsp;b&nbsp;=&nbsp;</font><font color="#7f0055"><b>false</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>if&nbsp;</b></font><font color="#000000">(</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora&nbsp;&gt;=&nbsp;p.hora</font><font color="#000000">)&nbsp;</font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>else&nbsp;if&nbsp;</b></font><font color="#000000">(</font><font color="#7f0055"><b>this</b></font><font color="#000000">.hora&nbsp;==&nbsp;p.hora&nbsp;&amp;&amp;&nbsp;</font><font color="#7f0055"><b>this</b></font><font color="#000000">.cmin&nbsp;&gt;=&nbsp;p.cmin</font><font color="#000000">)&nbsp;</font><font color="#000000">b&nbsp;=&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;</b></font><font color="#000000">b;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#000000">}</font></code>
    
   </td>
  <!-- end source code -->
   </tr>
</table>
</div>
<!-- =       END of automatically generated HTML code       = -->
<!-- ======================================================== -->


</body></html>